package com.reptile.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.util.Objects;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("新闻类")
@TableName("db_news")
public class YsNews {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("id")
    private Long id;

    @ApiModelProperty("新闻内容")
    private String content;

    @ApiModelProperty("新闻标题")
    private String title;

    @ApiModelProperty("新闻连接")
    private String url;

    @ApiModelProperty("新闻图片连接")
    private String pictureUrl;

    @ApiModelProperty("新闻时间")
    private LocalDate newsDate;

    @ApiModelProperty("爬取新闻时间")
    private LocalDate crawlingDate;

    @ApiModelProperty("新闻分类")
    private String newType;


    @Override
    public boolean equals(Object o) {
        YsNews ysNews = (YsNews) o;
        return content.equals(ysNews.content) && title.equals(ysNews.title) && url.equals(ysNews.url) && newType.equals(ysNews.newType);
    }

    @Override
    public int hashCode() {
        return Objects.hash(content, title, url, newType);
    }
}
